// Playground - noun: a place where people can play

import Cocoa


/*********************************************************************
 * The Swift Language Learning  Chapter 12: Inheritance
 *********************************************************************/

class Vehicle {
	
	@final var numberOfWheels: Int = 0 //must have a default value if you don't write init() initializer
	
	var maxPassengers: Int = 0
	
	func description() -> String {
		return "\(numberOfWheels) wheels; up to \(maxPassengers) passengers"
	}
	
	init() {
		numberOfWheels = 0
		maxPassengers = 1
	}
}

let car = Vehicle()
car.numberOfWheels
car.maxPassengers


class Bicycle: Vehicle {
	init()  {
		super.init()
		numberOfWheels = 2
	}
}

let bike = Bicycle()
bike.numberOfWheels


//overide 
class Car:Vehicle {
	
	//override property
	override var maxPassengers:Int {
	get{
		return self.maxPassengers
	}
	set {
		self.maxPassengers = 5
	}
	}
	
//	override var numberOfWheels { can override because it's final
//	get {
//		
//	}
//	set {
//		
//	}
//	}
	
	
	init()  {
		super.init()
	}
	
	override func description() -> String  {
		return "i am a car"
	}
}













